// commons/diy/banner/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    banner_list: {
      type: Array,
      value: null
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    swiperCurrent: 0
  },

  ready:function () {
    if (!this.properties.banner_list) {
      this.getDiyInfo();
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    swiperChange(e) {
      const that = this;
      that.setData({
        swiperCurrent: e.detail.current
      })
    }, 
    navigatorClickBabber: function (t) {console.log(t);
      this.triggerEvent('navigatorClickBabber', t);
      return false;
    },
    getDiyInfo: function () {
      var that = this;
      var shop = wx.getStorageSync('address_info');
      var shop_id = shop && shop.shop_id ? shop.shop_id : 0
      var item = {
        name: 'banner',
        shop_id: shop_id
      };
      getApp().request({
        url: getApp().api.index.get_diy_info,
        data: item,
        success: function(t) {
          that.setData({
            banner_list : t.data.list
          })
        },
        complete: function() {
          
        }
      })
    },
  }
})
